package com.uqbar.asteroids.components;




import com.uqbar.asteroids.scenes.AsteroidScene;
import com.uqbar.asteroids.strategies.EstrategiaPlayer;
import com.uqbar.vainilla.DeltaState;
import com.uqbar.vainilla.GameComponent;


public class Player extends GameComponent<AsteroidScene> {

	private EstrategiaPlayer estrategia;
	private PlayerShip selectedShip;
	

	public EstrategiaPlayer getEstrategia() {
		return estrategia;
	}

	public void setEstrategia(EstrategiaPlayer estrategiaPlayer) {
		this.estrategia = estrategiaPlayer;
	}

	@Override
	public void update(DeltaState deltaState) {
		this.estrategia.update(this, deltaState);
		//this.coordinarImagen();	
		super.update(deltaState);
	}
	
	public void izquierda(double delta) {
		this.selectedShip.izquierda(delta);
	}
	
	public void derecha(double delta) {
		this.selectedShip.derecha(delta);
	}
	
	public void arriba(double delta){
		this.selectedShip.arriba(delta);
	}
	
	public void abajo(double delta){
		this.selectedShip.abajo(delta);
	}
	
	public void shoot(){
		this.selectedShip.shoot();
	}

	public Player(int screenWidth, int screenHeigth, PlayerShip selectedShip){
		this.selectedShip=selectedShip;
		this.selectedShip.setxMax(screenWidth);
		this.selectedShip.setyMax(screenHeigth);
		this.selectedShip.setX(screenWidth/2);
		this.selectedShip.setY(screenHeigth-(this.selectedShip.getRadio()));
		this.setEstrategia(new EstrategiaPlayer());
	}
	
	
	

}
